package com.huilian.iotbox.admin.controller;


import com.huilian.iotbox.admin.service.SmsCodeService;
import com.huilian.iotbox.admin.service.UserService;
import com.huilian.iotbox.data.common.ServerResponse;
import com.huilian.iotbox.data.controller.BaseController;
import com.huilian.iotbox.data.vo.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author 谢洛涛
 * @date 2020/10/27 16:02
 */
@RestController
@RequestMapping("/api/smsCode")
public class SmsCodeController extends BaseController {
    @Autowired
    private SmsCodeService smsCodeService;
    @Autowired
    private UserService userService;
    @GetMapping("/sendCode")
    public ServerResponse sendSmsCode(HttpServletRequest request) {
        UserInfo userInfo = userService.getLoginUserInfo(request);
        return smsCodeService.sendSmsCode(userInfo.getId());
    }
}
